﻿#region imports

using System;
using System.Text;
using System.ComponentModel;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;

using CondeNet.AssetManager.Business.Interface;

#endregion

namespace CondeNet.AssetManager.Business
{
    public class AssetContentMetaData : IAssetContentMetaData
    {
        #region properties

        [XmlElement ( "id" )]
        public int ID { get; set; }

        [XmlIgnore]
        public int AssetContentID { get; set; }

        [XmlIgnore]
        public int MetaDataID { get; set; }

        [XmlIgnore]
        public int StatusID { get; set; }

        [XmlElement ( "metadata" )]
        public IMetaData MetaData { get; set; }
        
        [XmlElement ( "assetcontent" )]
        public IAssetContent AssetContent { get; set; }
        
        [XmlElement ( "status" )]
        public IStatus Status { get; set; }

        #endregion

        #region constructors

        public AssetContentMetaData ( ) { }

        public AssetContentMetaData ( int id , int assetContentId , int metaDataId , int statusId )
        {
            this.ID = id;
            this.AssetContentID = assetContentId;
            this.MetaDataID = metaDataId;
            this.StatusID = statusId;
        }

        public AssetContentMetaData ( IAssetContentMetaData entity )
        {
            this.ID = entity.ID;
            this.AssetContentID = entity.AssetContentID;
            this.MetaDataID = entity.MetaDataID;
            this.StatusID = entity.StatusID;
        }

        public AssetContentMetaData ( IAssetContentMetaData entity , IMetaData metaData ) 
        {
            this.ID = entity.ID;
            this.AssetContentID = entity.AssetContentID;
            this.MetaDataID = entity.MetaDataID;
            this.StatusID = entity.StatusID;
            this.MetaData = metaData;
        }

        #endregion

        #region overridden methods

        public override string ToString ( )
        {
            StringBuilder str = new StringBuilder ( );

            str.Append ( "-> ID: " + this.ID.ToString ( ) );
            str.Append ( "-> AssetContentID: " + this.AssetContentID.ToString ( ) );
            str.Append ( "-> MetaDataID: " + this.MetaDataID.ToString ( ) );
            str.Append ( "-> StatusID: " + this.StatusID.ToString ( ) );

            return str.ToString ( );
        }

        #endregion
    }
}
